<?php
namespace app\mobile\controller;
use app\api\controller\Pub;

use app\common\model\Agent;
use app\common\model\CardMember;
use app\common\model\CardQrcode;
use app\common\model\Merchant;
use app\common\model\Paylog;
use think\Request;
use think\Session;
class OrderThree extends Pub
{

    //流水统计
    public function turnover_statis($param)
    {
        try {
            $Paylog = new Paylog();
            $map['mid'] = ['in', $param['merchantid']];
            $start_time = strtotime($param['start_time']);
            $end_time = $start_time + 86399;
            $map['pay_time'] = [];
            $list = $Paylog->where($map)->field('id,merchant')->order('a.id desc')->select();
            if ($list) {
                $data['return_code'] = "SUCCESS";
                $data['return_msg'] = "SUCCESS";
                $data['result_code'] = "SUCCESS";
                $data['result_msg'] = "SUCCESS";
                $data['return_code'] = "SUCCESS";
                foreach ($list as $k => $v) {
                    $mach[$k]['merchantid'] = $v['id'];
                    $mach[$k]['merchantname'] = $v['merchant'];
                }
                $data['info'] = $mach;

            } else {
                $data = array("return_code" => "SUCCESS", "return_msg" => "SUCCESS", "result_code" => "FAIL", "result_msg" => "没有找到该门店",);
            }
        } catch (\Exception $e) {
            $data = array("return_code" => "FAIL", "return_msg" => "系统错误", "result_code" => "FAIL", "result_msg" => $e->getMessage());
        }
        return $data;
    }



}
